
<?php if($mode == "ADD"){?>
<section class="wrapper">

	<section class="panel">
		<div class="inbox-head">
			<div class="col-lg-12">
				<h3>ADD USER</h3>
				<a title="All User" href="<?= base_url();?>secure/member/user/all/"><button type="button" class="btn btn-danger pull-right">
					<i class="icon-list"></i>
				</button></a>
			</div>
		</div>
		
		

		<div class="panel-body">
			
			<?php if($this->session->flashdata('message')){?>
			<p class="alert alert-block text-danger"><?php echo $this->session->flashdata('message')?> </p>
			<?php }?>
			
			<div class="col-lg-10">
				<section class="panel">
					<div class="panel-head">

						<form class="form-horizontal" name="web_settings" method="POST"
							action="<?= base_url();?>secure/member/user/submit">

							
							<input type="hidden"
								name="id"
								value="" />

							<div class="border-head">
								<h3>User Information</h3>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label"> User Name</label>

								<div class="col-lg-6">
									<span class="text text-danger"> <?php echo form_error('name'); ?>
								</span> 
									<input type="text" class="form-control" name="name"
										placeholder="User Name" value="<?php echo set_value('name');?>">

								</div>
							</div>
							
							<div class="form-group">
								<label class="col-lg-2 control-label"> Email</label>

								<div class="col-lg-6">
								<span class="text text-danger"> <?php echo form_error('email'); ?>
								</span> 
									<input type="text" class="form-control" name="email"
										placeholder="Email" value="<?php echo set_value('email');?>">

								</div>
							</div>
							
							<div class="form-group">
								<label class="col-lg-2 control-label"> Gender</label>

								<div class="col-lg-3">
									<span class="text text-danger"> <?php echo form_error('gender'); ?>
								</span> 
									<select name="gender" class="form-control">
									<option value="" selected="selected">----Select Gender----</option>
										<option value="male">Male</option>
										<option value="female">Female</option>
									</select>

								</div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label"> User Type</label>

								<div class="col-lg-3">
										<span class="text text-danger"> <?php echo form_error('type'); ?>
								</span> 
									<select name="type" class="form-control">
									<option value="" selected="selected">----Select User Type----</option>
										<option value="1" >General</option>
										<option value="2">Administrator</option>
									</select>

								</div>
							</div>
							

							<div class="border-head">
								<h3>Location Information</h3>
							</div>

							<div class="form-group">
								<label class="col-lg-2 control-label">Region/State</label>

								<div class="col-lg-4">
									<span class="text text-danger"> <?php echo form_error('region'); ?>
								</span> 
									<?php if(isset($region)){?>
									<select name="region" class="form-control" name="region" id="region">
									<option value="" selected="selected">-- -- -- --Select Region-- -- -- --</option>
									<?php foreach($region as $region):?>
										
										<option value="<?= $region->id;?>"><?= $region->name;?></option>
									<?php endforeach;?>
									</select>
									<?php }?>	
								</div>
							</div>

							<div class="form-group">
								<label class="col-lg-2 control-label">City</label>

								<div class="col-lg-4">
									<span class="text text-danger"> <?php echo form_error('city'); ?>
								</span>
									<select name="city" id="city" class="form-control" disabled="disabled">
										
									</select>

								</div>
							</div>
							

							<div class="border-head">
								<h3>Password</h3>
							</div>

							<div class="form-group">
								<label class="col-lg-2 control-label">Password</label>
								<div class="col-lg-4">
									<span class="text text-danger"> <?php echo form_error('password'); ?>
								</span><input type="text"
										class="form-control" name="password"
										placeholder="Password..">
								</div>
							</div>

							<div class="form-group">
								<label class="col-lg-2 control-label">Retype Password</label>
								<div class="col-lg-4">
								<span class="text text-danger"> <?php echo form_error('retype_password'); ?>
								</span>
									<input type="text" class="form-control"
										placeholder="Retype Password.." name="retype_password">
								</div>
							</div>




							<div class="form-group">
								<div class="1col-lg-offset-2 1col-lg-10">
									<input type="submit" class="pull-right btn btn-success"
										value="Save" name="save_settings" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Not allowed in Demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');"  >
								</div>
							</div>

						</form>
					</div>

				</section>
			</div>
		</div>
	</section>

</section>
<?php }?>

<?php if($mode == "EDIT"){?>
<section class="wrapper">

	<section class="panel">
		<div class="inbox-head">
			<div class="col-lg-12">
				<h3>EDIT USER : <?= $user['name'];?></h3>
				<a title="All User" href="<?= base_url();?>secure/member/user/all/"><button type="button" class="btn btn-danger pull-right">
					<i class="icon-list"></i>
				</button></a>
			</div>
		</div>
		
		

		<div class="panel-body">
			
			<?php if($this->session->flashdata('message')){?>
			<p class="alert alert-block text-danger"><?php echo $this->session->flashdata('message')?> </p>
			<?php }?>
			
			<div class="col-lg-10">
				<section class="panel">
					<div class="panel-head">

						<form class="form-horizontal" name="web_settings" method="POST"
							action="<?= base_url();?>secure/member/user/update">

							
							<input type="hidden"
								name="id"
								value="" />

							<div class="border-head">
								<h3>User Information</h3>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label"> User Name</label>

								<div class="col-lg-6">
									<span class="text text-danger"> <?php echo form_error('name'); ?>
								</span> 
									<input type="text" class="form-control" name="name"
										placeholder="User Name" value="<?= $user['name'];?>">

								</div>
							</div>
							
							<div class="form-group">
								<label class="col-lg-2 control-label"> Email</label>

								<div class="col-lg-6">
								<span class="text text-danger"> <?php echo form_error('email'); ?>
								</span> 
									<input type="text" class="form-control" name="email"
										placeholder="Email" value="<?= $user['email'];?>">

								</div>
							</div>
							
							<div class="form-group">
								<label class="col-lg-2 control-label"> Gender</label>

								<div class="col-lg-3">
									<span class="text text-danger"> <?php echo form_error('gender'); ?>
								</span> 
									<select name="gender" class="form-control">
									<option value="" selected="selected">----Select Gender----</option>
										<option value="male" <?php if($user['gender'] == "male") echo "Selected='selected'";?>>Male</option>
										<option value="female" <?php if($user['gender'] == "female") echo "Selected='selected'";?>>Female</option>
									</select>

								</div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label"> User Type</label>

								<div class="col-lg-3">
										<span class="text text-danger"> <?php echo form_error('type'); ?>
								</span> 
									<select name="type" class="form-control">
									<option value="" selected="selected">----Select User Type----</option>
										<option value="1" <?php if($user['type'] == "1") echo "Selected='selected'"?>>General</option>
										<option value="2" <?php if($user['type'] == "2") echo "Selected='selected'"?>>Administrator</option>
									</select>

								</div>
							</div>
							

							<div class="border-head">
								<h3>Location Information</h3>
							</div>

							<div class="form-group">
								<label class="col-lg-2 control-label">Region/State</label>

								<div class="col-lg-4">
									<span class="text text-danger"> <?php echo form_error('region'); ?>
								</span> 
									<?php if(isset($region)){?>
									<select name="region" class="form-control" name="region" id="region">
									<option value="" selected="selected">-- -- -- --Select Region-- -- -- --</option>
									<?php foreach($region as $region):?>
										
										<option value="<?= $region->id;?>" <?php if($region->id == $user['region']){echo "selected=selected";}?>><?= $region->name;?></option>
									<?php endforeach;?>
									</select>
									<?php }?>	
								</div>
							</div>

							<div class="form-group">
								<label class="col-lg-2 control-label">City</label>

								<div class="col-lg-4">
									<span class="text text-danger"> <?php echo form_error('city'); ?>
								</span>
									<?php if(isset($city)){?>
									<select name="city" class="form-control"id="city">
									<option value="" selected="selected">-- -- -- --Select City-- -- -- --</option>
									<?php foreach($city as $city):?>
										
										<option value="<?= $city->id;?>" <?php if($city->id == $user['city']){echo "selected=selected";}?>><?= $city->name;?></option>
									<?php endforeach;?>
									</select>
									<?php }?>	

								</div>
							</div>
							

							<div class="border-head">
								<h3>Password</h3>
							</div>

							<div class="form-group">
								<div class="1col-lg-offset-2 1col-lg-10">
								<input type="hidden" name="user_id" id="user_id" value="<?= $user['id'];?>">
									<input type="submit" class="pull-right btn btn-success"
										value="Save" name="save_settings" <?php if($this->config->item('mode')=='DEMO'){?>onclick="alert ('Sorry! Not allowed in Demo mode '); return false;" <?} else?>onclick="return confirm('Are you sure ?');"  >
								</div>
							</div>

						</form>
					</div>

				</section>
			</div>
		</div>
	</section>

</section>
<?php }?>

